package com.huanxing.cloud.product.api.feign;

import com.huanxing.cloud.common.core.constant.SecurityConstants;
import com.huanxing.cloud.common.core.constant.ServiceNameConstants;
import com.huanxing.cloud.common.core.util.Result;
import com.huanxing.cloud.product.api.dto.GoodsSkuStockReqDTO;
import com.huanxing.cloud.product.api.entity.GoodsSku;
import com.huanxing.cloud.product.api.entity.GoodsSkuSpecsValue;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteGoodsSkuService", value = ServiceNameConstants.PRODUCT_SERVICE)
public interface RemoteGoodsSkuService {

	/**
	 * 批量回滚库存
	 * @param goodsSkuStockReqDTOList
	 * @return void
	 */
	@PostMapping("/app/sku/rollback")
	Result<Void> rollbackStock(List<GoodsSkuStockReqDTO> goodsSkuStockReqDTOList,
			@RequestHeader(SecurityConstants.SOURCE) String source);

	/**
	 * 扣减库存
	 * @param goodsSkuStockReqDTO
	 * @return Boolean
	 */

	@PostMapping("/app/sku/reduce-stock")
	Result<Boolean> reduceStock(@RequestBody List<GoodsSkuStockReqDTO> goodsSkuStockReqDTO,
			@RequestHeader(SecurityConstants.SOURCE) String source);

	/**
	 * 通过id批量查询
	 * @param ids
	 * @return
	 */
	@GetMapping("/app/sku/getBySkuIds")
	Result<List<GoodsSku>> getBySkuIds(@RequestParam("ids") List<String> ids,
			@RequestHeader(SecurityConstants.SOURCE) String source);

	/**
	 * 通过skuId查询规格值
	 * @param skuId
	 * @return
	 */

	@GetMapping("/app/sku/selectGoodsSkuSpecsValueList")
	Result<List<GoodsSkuSpecsValue>> selectGoodsSkuSpecsValueList(@RequestParam("skuId") String skuId,
			@RequestHeader(SecurityConstants.SOURCE) String source);

	/**
	 * 通过id批量查询SKU 附带规格信息
	 * @param ids
	 * @return
	 */
	@GetMapping("/app/sku/getSkuByIds")
	Result<List<GoodsSku>> getSkuByIds(@RequestParam("ids") List<String> ids,
			@RequestHeader(SecurityConstants.SOURCE) String source);

}
